package com.jwork.progress.enums;

import com.jwork.progress.service.strategy.AddStrategy;
import com.jwork.progress.service.strategy.OperatorStrategy;
import com.jwork.progress.service.strategy.SubtractStrategy;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.function.Supplier;

/**
 * Notes: 计算方式
 * Author: smiler
 * Time: 2025/01/13 16:56
 */
@Getter
@AllArgsConstructor
public enum CalOperatorEnums {
    OP_ADD("add", () -> new AddStrategy()),
    OP_SUBTRACT("subtract", () -> new SubtractStrategy());

    private final String code;
    private final Supplier<OperatorStrategy> strategySupplier;

    public OperatorStrategy getOperatorStrategy() {
        return strategySupplier.get();
    }
}
